package org.extremengine;

import java.util.Map;

import org.extremengine.common.Collidable;
import org.extremengine.common.RigidBody;
import org.extremengine.common.Terrain;

/**
 * 
 * @author yuxing
 *
 */
public interface EngineCallback {

	/**
	 * Will be called once a frame of physical completed for displaying.
	 * Invoker may not fork the method into multi-thread, for correct FPS and avoid duplicate.
	 * @param t 发生时刻
	 * @param coordinateMap
	 */
	public void onFrame(long t, Map coordinateMap);
	
	/**
	 * Will be called every second with FPS.
	 * @param t 发生时刻
	 * @param fps
	 */
	public void onFps(long t, int fps);
	
	/**
	 * 两个刚体碰撞。
	 * @param t 发生时刻
	 * @param body1
	 * @param body2
	 */
	public void onCollision(long t, RigidBody body1, RigidBody body2);
	
	/**
	 * 刚体与地形碰撞
	 * @param t 发生时刻
	 * @param body
	 * @param terrain
	 */
	public void onCollision(long t, RigidBody body, Terrain terrain);
	
	/**
	 * 两个可碰撞物体相互接触。
	 * @param matter1
	 * @param matter2
	 */
	public void onStick(Collidable matter1, Collidable matter2);
}
